﻿#include "Mesh.h"
//#include "MeshTool.h"

//void Mesh::AttachBoundaryCondition(const std::map<std::string, UInt8>& bnd_name_id)
//{
//  MeshTool::AttachBoundaryCondition(*this, bnd_name_id);
//}

typename Mesh::CellLinkType Mesh::GetCellLinks()
{
  return vtkm::cont::make_ArrayHandleGroupVecVariable(_cell_links_flat, _face_num_offset);
}


const vtkm::cont::Field& Mesh::GetField(const std::string& name) const
{
  try
  {
    return _data_set.GetField(name);
  }
  catch (const std::exception& e)
  {
    console::Error(e.what());
  }
}

const vtkm::cont::Field& Mesh::GetCellField(const std::string& name) const
{
  try
  {
    return _data_set.GetCellField(name);
  }
  catch (const std::exception& e)
  {
    console::Error(e.what());
  }
}

const vtkm::cont::Field& Mesh::GetPointField(const std::string& name) const
{
  try
  {
    return _data_set.GetPointField(name);
  }
  catch (const std::exception& e)
  {
    console::Error(e.what());
  }
}


vtkm::cont::Field& Mesh::GetField(const std::string& name)
{
  try
  {
    return _data_set.GetField(name);
  }
  catch (const std::exception& e)
  {
    console::Error(e.what());
  }
}

vtkm::cont::Field& Mesh::GetCellField(const std::string& name)
{
  try
  {
    return _data_set.GetCellField(name);
  }
  catch (const std::exception& e)
  {
    console::Error(e.what());
  }
}

vtkm::cont::Field& Mesh::GetPointField(const std::string& name)
{
  try
  {
    return _data_set.GetPointField(name);
  }
  catch (const std::exception& e)
  {
    console::Error(e.what());
  }
}
